home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Science / Asymptote Demo / Examples / Demos / 1&2) Errorbars / Demo2 < prev   
Encoding:
Text File  |  1994-05-07  |  1.4 KB  |  42 lines  |  [TEXT/DWat]

  1. % Asymptote demo #2
  2. % Plot a basic log-log graph of y=x^2 with log error bars
  3.  
  4. graphunits in                % Use inches to measure page coordinates
  5. graphframe 2 7 2 7        % Set the location of the graph on the page
  6. fontname Times                % Change to the Times font for the graph
  7.  
  8. % Calculate y = x*x for x = 1 to 25
  9. npts 25                        % We will calculate 25 points
  10. rpn index >x                % Put 1,2,3,4...25 into the x vector
  11. rpn <x <x * >y                % Find the square of the x vector
  12. rpn 50 >e                    % Put a constant error of 50 into the e vector
  13.  
  14. rpn <x log >x                % Replace x and y with their logs
  15. rpn <y log >y
  16.  
  17. graphlimits                    % Set the graph limits to show all of the points
  18. graphticks -1 0 -1 0        % Choose log tick marks
  19. drawframe                    % Draw the frame around the graph
  20. scale 1.5                    % Make the scale factor bigger and draw the axis labels
  21. drawtitle Log Graph with Log Error Bars
  22. drawxlabel Log X
  23. drawylabel Log Y
  24.  
  25. pointsymbol 4 filled        % Choose filled squares for the point symbols
  26. scale 1.5                    % Draw big points
  27. plotpoints
  28. scale 1                        % Set the scale factor back
  29. pensize 1                     % Set up to draw 1 point thick line
  30. plotline                     % Plot the line
  31. pensize .25                    % Set up for hairlines
  32.  
  33. rpn <e >r0                    % Save the errors in register 0
  34.  
  35. rpn <y 10^x <e + log <y - >e        % Calculate the -y error and draw the error bar
  36. ploterrors bottom                        % Plot the errors
  37.  
  38. rpn <r0 >e                                % Recall the errors and do the same for the + y error
  39. rpn <y 10^x <e + log <y - >e
  40. ploterrors top                            % Plot the + y error bars
  41.  
  42. fullscreen yes